package org.cfx.basic.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author RTX 9090
 */
//@Configuration
//public class OpenApiConfig {
//
//    @Bean
//    public OpenAPI openApi() {
//        return new OpenAPI()
//                .info(new Info()
//                        .title("部门管理平台")
//                        .description("部门管理平台接口文档")
//                        .contact(new Contact().name("cfx").email("1905333495@qq.com"))
//                        .version("v2.0"));
//    }
//}

@Configuration
//@AutoConfigureBefore(SpringDocConfiguration.class)
public class OpenApiConfig {

    @Bean
    public OpenAPI openApi() {
        return new OpenAPI()
                .info(
                        new Info()
                                .title("部门管理平台")
                                .description("部门管理平台文档接口")
                                .contact(new Contact().name("cfx").email("1905333495@qq.com"))
                                // 参考 Apache 2.0 许可及地址，你可以不配此项
                                .license(new License().name("Apache 2.0").url("https://www.apache.org/licenses/LICENSE-2.0.html"))
                                .version("2.0")
                )
                // 引入外部的文档，我这里引得是 springdoc 官方文档地址，你可以不配此项
                .externalDocs(new ExternalDocumentation()
                        .description("SpringDoc Full Documentation")
                        .url("https://springdoc.org/")
                );
    }

}
    /*
        @Api -> @Tag
        @ApiIgnore -> @Parameter(hidden = true) 或 @Operation(hidden = true) 或 @Hidden
        @ApiImplicitParam -> @Parameter
        @ApiImplicitParams -> @Parameters
        @ApiModel -> @Schema
        @ApiModelProperty(hidden = true) -> @Schema(accessMode = READ_ONLY)
        @ApiModelProperty -> @Schema
        @ApiOperation(value = "foo", notes = "bar") -> @Operation(summary = "foo", description = "bar")
        @ApiParam -> @Parameter
        @ApiResponse(code = 404, message = "foo") -> @ApiResponse(responseCode = "404", description = "foo")
    */

